package com.dq.educms.controller;

import com.dq.commonutils.cache.Cache;
import com.dq.commonutils.vo.Result;
import com.dq.educms.service.CrmBannerService;
import com.dq.educms.vo.BannerVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @project: guli_parent
 * @ClassName: BannerFrontController
 * @author: dq
 * @creat: 2022/8/5 15:15
 */
@RestController
@RequestMapping("educms/banner")
// @CrossOrigin
public class BannerFrontController {
    @Autowired
    private CrmBannerService bannerService;


    /**
     * 获取所有Banner元素
     * @return
     */
    @GetMapping("getAllBanner")
    @Cache(expire = 5 * 60 * 1000, name = "获取Banner图片")
    public Result getAllBanner(){
        List<BannerVo> bannerVoList = bannerService.getBannerList();
        return Result.success(bannerVoList);
    }
}
